package com.yazi.mxz.common.db.dao.impl;


import org.hibernate.Criteria;
import org.hibernate.criterion.Restrictions;
import org.springframework.stereotype.Repository;

import com.yazi.mxz.common.db.dao.StoreRestockDao;
import com.yazi.mxz.common.entity.beans.Store;
import com.yazi.mxz.common.entity.beans.StoreRestock;

import com.myframework.smhj.hibernate.dao.BasicDao;

@Repository("storeRestockDao")
public class StoreRestockDaoImpl extends BasicDao<StoreRestock> implements StoreRestockDao {


	public StoreRestockDaoImpl() {
		super(StoreRestock.class);
	}

	@Override
	public Criteria getExample(StoreRestock sr, String searchWord) {
		Criteria c = super.getExample(sr, searchWord);
		if (null != sr) {
			Store store = sr.getStore();
			if (null != store) {
				if (null != store.getStoreId()) {
					c.add(Restrictions.eq("store.storeId", store.getStoreId()));
				} else {
					// ...other Store's fields search
				}
			}
			// ...other StoreRestock's fields search
		}
		// ...searchWord search	
		return c;
	}

}
